package com.zhentao.file.config;

import io.minio.MinioClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;

@EnableConfigurationProperties(MinioConfigProperties.class)
public class MinioConfig {
    @Autowired
    private MinioConfigProperties minioConfigProperties;


    @Bean
    public MinioClient minioClient() {
        return MinioClient.builder()
                .credentials(minioConfigProperties.getAccesskey(), minioConfigProperties.getSecretkey())
                .endpoint(minioConfigProperties.getEndpoint()).build();
    }
}
